<script setup lang="ts">
const props = defineProps({
  money: {
    type: Number,
    default: 9,
  },
})

const emit = defineEmits<{
  // 固定的事件名  update:xxx
  (e: 'update:money', value: number): void
}>()

const payMoney = () => {
  emit('update:money', props.money - 1)
}
</script>

<template>
  <div>我是子组件 - {{ money }}</div>
  <button @click="payMoney">花钱</button>
</template>

<style scoped></style>
